<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- creator-diff-editor.qdoc -->
  <title>Comparing Files | Qt Creator Manual</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt Creator Manual</a></td><td >Comparing Files</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="index.html">Qt Creator Manual 4.11.1</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="creator-macros.html" />
  <link rel="next" href="creator-clang-codemodel.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="creator-macros.html">Using Text Editing Macros</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-clang-codemodel.html">Parsing C++ Files with the Clang Code Model</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#viewing-the-changes">Viewing the Changes</a></li>
<li class="level1"><a href="#changing-the-colors">Changing the Colors</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Comparing Files</h1>
<span class="subtitle"></span>
<!-- $$$creator-diff-editor.html-description -->
<div class="descr"> <a name="details"></a>
<p>You can use a diff editor to display unsaved changes in the current file or all open files or to compare any two text files that can be either versions of the same file or arbitrary files.</p>
<p>To view unsaved changes in the current file, select <b>Tools</b> &gt; <b>Diff</b> &gt; <b>Diff Current File</b>.</p>
<p>To view unsaved changes in all open files, select <b>Tools</b> &gt; <b>Diff</b> &gt; <b>Diff Open Files</b>.</p>
<p>To compare two files:</p>
<ol class="1" type="1"><li>Select <b>Tools</b> &gt; <b>Diff</b> &gt; <b>Diff External Files</b>.</li>
<li>Select two files to compare.</li>
</ol>
<a name="viewing-the-changes"></a>
<h2 id="viewing-the-changes">Viewing the Changes</h2>
<p class="centerAlign"><img src="images/creator-diff-editor.png" alt="&quot;Diff editor output in the Edit mode&quot;" /></p><p>The changes are displayed in the <b>Edit</b> mode. Color coding is used to mark changed lines. By default, light red indicates lines that contain removed text (painted a darker red) in the left pane and light green indicates lines that contain added text (painted a darker green) in the right pane.</p>
<p>To revert the changes, right-click added text and then select <b>Revert Chunk</b> in the context menu. To apply the changes, select removed text and then select <b>Apply Chunk</b>.</p>
<p>To view the differences in a unified view where changed rows are placed below each other, select <img src="images/unifieddiff.png" alt="" /> (<b>Switch to Unified Diff Editor</b>).</p>
<p>To switch back to the side-by-side view, select <img src="images/sidebysidediff.png" alt="" /> (<b>Switch to Side by Side Diff Editor</b>).</p>
<p>To only show text changes, select <b>Ignore Whitespace</b>.</p>
<p>To expand the context for the changes, set the number of unchanged lines to show in <b>Context lines</b>.</p>
<p>By default, the horizontal scroll bars in the left and right pane are synchronized. To use them independently of each other, select the <img src="images/linkicon.png" alt="" /> (<b>Synchronize Horizontal Scroll Bars</b>) button.</p>
<p>If the files change outside Qt Creator, select <img src="images/reload_gray.png" alt="" /> (<b>Reload Editor</b>) to compare them again and to show the results.</p>
<p>To send a chunk of changes to a <a href="creator-editor-codepasting.html">code pasting service</a>, select <b>Send Chunk to CodePaster</b> in the context menu.</p>
<a name="changing-the-colors"></a>
<h2 id="changing-the-colors">Changing the Colors</h2>
<p>To change the default colors, select <b>Tools</b> &gt; <b>Options</b> &gt; <b>Text Editor</b> &gt; <b>Font &amp; Colors</b>. Create your own color scheme and select new colors for the following options:</p>
<ul>
<li><b>Diff File Line</b> sets the color of the line that shows the path and filename of the changed file.</li>
<li><b>Diff Context Line</b> sets the color of the line that shows the number of hidden lines between changed lines.</li>
<li><b>Diff Source Line</b> sets the color of lines that contain removed text.</li>
<li><b>Diff Source Character</b> sets the color that indicates removed characters.</li>
<li><b>Diff Destination Line</b> sets the color of lines that contain added text.</li>
<li><b>Diff Destination Character</b> sets the color that indicates added characters.</li>
</ul>
</div>
<!-- @@@creator-diff-editor.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="creator-macros.html">Using Text Editing Macros</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-clang-codemodel.html">Parsing C++ Files with the Clang Code Model</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
